import { Body, Controller, Get, Post } from "@nestjs/common";
import { ApiBody, ApiTags } from "@nestjs/swagger";
import { get } from "mongoose";
import { Cat } from "src/schemas/cat.schema";
import { CatsService } from "src/service/cats.service";

@ApiTags("cats")
@Controller("cats")
export class CatsController {
    constructor(private readonly catsService: CatsService) { }

    @Post("/save")
    @ApiBody({ type: Cat })
    async save(@Body()cat: Cat): Promise<any> {
        return await this.catsService.create(cat);
    }
    @Get("/list")
    async findAll(): Promise<Cat[]> {
        return await this.catsService.findAll();
    }

}